<script>
$("#formtable").validator({
    submit: function() {
        if(this.isFormValid()) {
            var that = $("#formtable");
            $.ajax({
                url: location.href
                , type: 'post'
                , data: that.serialize()
                , dataType: 'json'
                , success: function (response) {
                    layer.msg(response.msg);
                    if (response.code === 0) {
                        setTimeout(function () {
                            if(typeof parent.dialogReback == 'function') {
                                parent.dialogReback();
                            }
                            parent.layer.closeAll('iframe');
                        }, 1000);
                    }
                }
                , error: function (error) {
                    layer.msg('数据提交失败！');
                }
            });
        }
        return false;
    }
});

</script>